package com.wsy.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

import java.awt.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;


@Configuration
@ComponentScan(basePackages = {"com.wsy.controller","com.wsy.service"})
@EnableWebMvc
public class SpringMvcConfig implements WebMvcConfigurer {


    @Bean
    public InternalResourceViewResolver viewResolver(){
        InternalResourceViewResolver resolver=new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/jsp/");
        resolver.setSuffix(".jsp");

        return resolver;
    }





//    @Override
//    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//        StringHttpMessageConverter converter01=new StringHttpMessageConverter(Charset.forName("UTF-8"));
//        FastJsonHttpMessageConverter converter02=new FastJsonHttpMessageConverter();
//        converter02.setDefaultCharset(Charset.forName("UTF-8"));
//        FastJsonConfig config=new FastJsonConfig();
//        config.setDateFormat("yyyy-MM-dd HH:mm");
//        converter02.setFastJsonConfig(config);
//        converters.add(converter01);
//        converters.add(converter02);
//    }






}
